package cn.edu.buaa.nlsde.mpj.fw.invoker.loader;

import cn.edu.buaa.nlsde.mpj.fw.model.parameter.LoopParameter;
import org.dom4j.Element;

public class LoopParameterResolver extends VariableResolver {
    @Override
    public LoopParameter resolve(Element element) {
        String name = element.attributeValue("name");
        String type = element.element("type").getTextTrim();
        String start = element.element("start").getTextTrim();
        String step = element.element("step").getTextTrim();
        String end = element.element("end").getTextTrim();
        log.info("开始构建循环变量" + name + ":起始值-->" + start
                + "，最终值-->" + end + "，步长-->" + step + "。");
        LoopParameter lp = new LoopParameter();
        lp.setName(name);
        lp.setType(type);
        lp.setStart(start);
        lp.setEnd(end);
        lp.setStep(step);
        log.info("构建循环变量" + name + "结束。");
        return lp;
    }


}
